package gjw.recycleviewdemo;

import android.app.Activity;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;

import java.util.ArrayList;
import java.util.List;

import gjw.recycleviewdemo.adapter.RecycleviewAdapter;

/**
 * @创建者 Jimven
 * @创建时间 2017/12/27/0027  10:07
 */
public class RecycleViewActivity extends Activity {

    private RecyclerView mRecycleview_hor;
    private List         mTitle;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_recycleview);
        initView();
        initListener();
        initData();
        initEvent();
    }

    private void initView() {
        mRecycleview_hor = (RecyclerView) findViewById(R.id.recycleview_hor);
        LinearLayoutManager manager = new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false);
        mRecycleview_hor.setLayoutManager(manager);
    }

    private void initListener() {

    }

    private void initData() {
        mTitle = new ArrayList();
        mTitle.add("aa");
        mTitle.add("bb");
        mTitle.add("cc");
        mTitle.add("dd");
        mTitle.add("ee");
        mTitle.add("ff");
        RecycleviewAdapter recycleviewAdapter = new RecycleviewAdapter(mTitle, this);
        mRecycleview_hor.setAdapter(recycleviewAdapter);

    }

    private void initEvent() {

    }
}
